<template>
  <div class="main">
    <el-header>
      <div class="header-leftbox1">
        <img :src="avaterImg" alt="" />
        <span>我的订单</span>
      </div>
      <div class="header-right">
        <el-button type="info" @click="logout">返回首页</el-button>
      </div>
    </el-header>
    <div class="orderMain">
      <div class="myorderBox">
        <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/order' }"
            >我的订单</el-breadcrumb-item
          >
          <el-breadcrumb-item :to="{ path: '/order' }"
            >订单详情</el-breadcrumb-item
          >
        </el-breadcrumb>
      </div>
      <div class="orderMainArea">
        <div class="leftBox">
          <div class="titleBox">
            <i
              class="iconfont icon-daifukuan"
              v-if="orderDetileInfo.orderStatus === '待付款'"
            ></i>
            <i
              class="iconfont icon-yiwancheng"
              v-if="orderDetileInfo.orderStatus === '已完成'"
            ></i>
            <i
              class="iconfont icon-daipingjia01"
              v-if="orderDetileInfo.orderStatus === '待评价'"
            ></i>
            <i
              class="iconfont icon-daishouhuo"
              v-if="orderDetileInfo.orderStatus === '待收货'"
            ></i>
            <h3>订单{{ orderDetileInfo.orderStatus }}</h3>
          </div>
          <div class="sendTypeBox">
            <h3>配送方式：{{ orderDetileInfo.distributionType }}</h3>
          </div>
          <div
            class="itemList"
            v-for="item in orderDetileInfo.orderItemList"
            :key="item"
          >
            <div class="left">
              <div class="imageBox">
                <img :src="item.defaultImage" alt="" />
              </div>
              <div class="skuNameB">
                {{ item.skuName }}
              </div>
            </div>
            <div class="priceBox">￥{{ item.originalPrice }}.00</div>
          </div>
        </div>
        <div class="rightBox">
          <div class="InfoBox">
            <h3>收货信息</h3>
            <span>收货人：{{ receiveInfo.name }}</span>
            <span>联系方式：{{ receiveInfo.phone }}</span>
            <span>收货地址：{{ receiveInfo.address }}</span>
          </div>
          <div class="InfoBox">
            <h3>订单信息</h3>
            <span>订单编号：{{ orderDetileInfo.serialNo }}</span>
            <span>下单时间：{{ orderDetileInfo.updatedTime }}</span>
          </div>
          <div class="InfoBox">
            <h3>商品信息</h3>
            <span>商品总额：{{ orderDetileInfo.totalAmount }}</span>
            <span>配送费用：{{ orderDetileInfo.freight }}</span>
            <span>应付金额：{{ orderDetileInfo.paymentAmount }}</span>
          </div>
        </div>
      </div>
    </div>
    <footer-view></footer-view>
  </div>
</template>
<script>
export default {
  data() {
    return {
      avaterImg: "",
      orderDetileInfo: {},
      serialNo: "1524637505796820993",
      receiveInfo: {},
    };
  },
  computed: {},
  setup() {},
  mounted() {
    this.init();
  },
  methods: {
    init() {
      let userInfo = this.$store.getters.getUserInfo;
      if (userInfo.avatar) {
        this.avaterImg = userInfo.avatar;
      }
      this.orderDetileInfo = JSON.parse(sessionStorage.getItem("orderInfo"));
      console.log(this.orderDetileInfo);
      this.orderDetileInfo.totalAmount =
        Math.floor(this.orderDetileInfo.totalAmount * 100) / 100;
      this.orderDetileInfo.freight =
        Math.floor(this.orderDetileInfo.freight * 100) / 100;
      this.orderDetileInfo.paymentAmount =
        Math.floor(this.orderDetileInfo.paymentAmount * 100) / 100;
      this.receiveInfo = this.orderDetileInfo.receiveGoodsInfoEntity;
    },
  },
};
</script>

<style lang="scss">
.main {
  background-color: #f5f5f5;
  .el-header {
    background-color: #f6fbf6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 70px;
    .header-leftbox1 {
      display: flex;
      align-items: center;
      img {
        height: 30px;
        width: 30px;
        margin: 0 20px;
        border-radius: 50%;
        border: 1px solid #244d4d;
        box-shadow: 1px 1px #ededf1;
      }
      span {
        color: #244d4d;
        font-size: 30px;
        font-weight: bold;
      }
    }
    .header-right {
      display: flex;
      align-items: center;
      .el-button {
        font-weight: bold;
        background-color: #244d4d;
      }
    }
  }
  .orderMain {
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    .myorderBox {
      margin: 20px 0;
      padding: 0 30px;
      width: 1400px;
      height: 80px;
      background-color: #fff;
      display: flex;
      align-items: center;
      h3 {
        font-size: 15px;
        color: #666;
        line-height: 18px;
      }
    }
    .orderMainArea {
      width: 1400px;
      background-color: #fff;
      padding: 10px;
      min-height: 500px;
      display: flex;
      .leftBox {
        border-right: 1px solid #d2d1d1;
        width: 900px;
        .titleBox {
          display: flex;
          font-size: 20px;
          font-weight: 700;
          i {
            font-size: 20px;
            margin-right: 10px;
          }
        }
        .sendTypeBox {
          margin: 40px 0;
          h3 {
            font-size: 16px;
            line-height: 24px;
            color: #111;
            font-weight: 700;
          }
        }
        .itemList {
          display: flex;
          align-items: center;
          justify-content: space-between;
          width: 100%;
          border-bottom: 1px solid #f5f5f5;
          .left {
            display: flex;
            align-items: center;
            padding: 20px;
            .imageBox {
              height: 100px;
              width: 100px;
              img {
                height: 100%;
                width: 100%;
              }
            }
            .skuNameB {
              font-size: 14px;
              color: #111;
              font-weight: 700;
              margin-left: 40px;
              width: 200px;
            }
          }
          .priceBox {
            font-size: 18px;
            font-weight: 700;
            color: #111;
            margin-right: 10px;
          }
        }
      }
      .rightBox {
        padding-left: 20px;
        display: flex;
        flex-direction: column;
        .InfoBox {
          display: flex;
          flex: 1;
          flex-direction: column;
          border-bottom: 1px solid #f5f5f5;
          h3 {
            margin: 20px 0 5px 0;
          }
          span {
            font-size: 14px;
            margin: 5px 0;
          }
        }
      }
    }
  }
}
</style>
